package com.ftg.learn.controller;

import com.ftg.learn.comm.entity.question.Type;
import com.ftg.learn.service.ITypeService;
import com.ftg.learn.service.impl.TypeServiceImpl;
import com.ftg.learn.util.AbstractController;
import com.ftg.learn.util.ResBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author kangjx
 * @createTime 2022/11/13
 */
@RestController
@Api(tags = "类目管理")
@RequestMapping("/question/type")
public class TypeController extends AbstractController <TypeServiceImpl,Type> {

    @Resource
    ITypeService iTypeService;

    /**
     * 用来显示 全部试题类型
     *    生成 树形结构
     *    {
     *        id:
     *        name:
     *        children:[
     *          {
         *          id:
         *          name:
         *          children:[]
     *          }
     *        ]
     *    }
     * @return
     */
    @GetMapping("/byTree")
    @ApiOperation("树形结构展示")
    public ResBean showTypeWithTree(){
        return iTypeService.showTypeWithTree();
    }

}
